﻿using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;
using IndieStudio.BugsBang.Utility;

///Developed By Indie Studio
///https://assetstore.unity.com/publishers/9268
///www.indiestd.com
///info@indiestd.com

namespace IndieStudio.BugsBang.Game
{
	[DisallowMultipleComponent]
	public class SceneStartup : MonoBehaviour
	{
		// Use this for initialization
		void Start ()
		{
			ShowAd ();
		}

		/// <summary>
		/// Show an advertisment on scene startup
		/// </summary>
		public void ShowAd ()
		{
			if (SceneManager.GetActiveScene ().name == "Main") {
				AdsManager.instance.ShowAdvertisment (AdPackage.AdEvent.Event.ON_LOAD_MAIN_SCENE,null);
			} else if (SceneManager.GetActiveScene ().name == "Settings") {
				AdsManager.instance.ShowAdvertisment (AdPackage.AdEvent.Event.ON_LOAD_SETTINGS_SCENE,null);
			} else if (SceneManager.GetActiveScene ().name == "Levels") {
				AdsManager.instance.ShowAdvertisment (AdPackage.AdEvent.Event.ON_LOAD_LEVELS_SCENE,null);
			} else if (SceneManager.GetActiveScene ().name == "Game") {
				AdsManager.instance.ShowAdvertisment (AdPackage.AdEvent.Event.ON_LOAD_GAME_SCENE,null);
			}
		}

		void OnDestroy ()
		{
			AdsManager.instance.HideAdvertisment ();
		}
	}
}
